public class Location implements Comparable<Location>
{
	private final int x, y;

	public Location(int x, int y)
	{
		this.x = x;
		this.y = y;
	}

	public int getX()
	{
		return x;
	}

	public int getY()
	{
		return y;
	}

	@Override
	public String toString()
	{
		return "(" + x + "," + y + ")";
	}

	@Override
	public boolean equals(Object obj)
	{
		if (obj instanceof Location)
		{
			Location loc = (Location) obj;
			return loc.x == x && loc.y == y;
		}
		return false;
	}

	@Override
	public int compareTo(Location arg0)
	{
		int xDiff = x - arg0.x;
		return xDiff != 0 ? xDiff : y - arg0.y;
	}

}
